strat = cStratManual;
% shfe_ctp_codes = {'cu1811';'al1811';'zn1811';'pb1811';'ni1811';'rb1901'};
mdefut = cMDEFut;

configfilename = 'regressiontest_cstrat_funcs_configfile.txt';

strat.registermdefut(mdefut);

strat.loadriskcontrolconfigfromfile('filename',configfilename);

%%
instruments = strat.getinstruments;

clc;
fprintf('strategy default setup basic information:\n');
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','code',instruments{1}.code_ctp,instruments{2}.code_ctp,instruments{3}.code_ctp,instruments{4}.code_ctp,instruments{5}.code_ctp,instruments{6}.code_ctp);
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','stoptype',...
    strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','pnlstoptype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','pnlstoptype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','pnlstoptype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','pnlstoptype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','pnlstoptype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','pnlstoptype'));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','stopamount',...
    strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','pnlstop'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','pnlstop'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','pnlstop'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','pnlstop'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','pnlstop'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','pnlstop'));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','limittype',...
    strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','pnllimittype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','pnllimittype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','pnllimittype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','pnllimittype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','pnllimittype'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','pnllimittype'));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','limitamount',...
    strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','pnllimit'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','pnllimit'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','pnllimit'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','pnllimit'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','pnllimit'),...
    strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','pnllimit'));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','bidopenspread',...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','bidopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','bidopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','bidopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','bidopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','bidopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','bidopenspread')));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','bidclosespread',...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','bidclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','bidclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','bidclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','bidclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','bidclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','bidclosespread')));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','askopenspread',...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','askopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','askopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','askopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','askopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','askopenspread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','askopenspread')));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','askclosespread',...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','askclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','askclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','askclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','askclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','askclosespread')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','askclosespread')));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','baseunits',...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','baseunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','baseunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','baseunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','baseunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','baseunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','baseunits')));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','maxunits',...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','maxunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','maxunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','maxunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','maxunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','maxunits')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','maxunits')));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','autotrade',...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','autotrade')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','autotrade')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','autotrade')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','autotrade')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','autotrade')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','autotrade')));
%
fprintf('%25s%10s%10s%10s%10s%10s%10s\n','maxexecutionperbucket',...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{1}.code_ctp,'propname','maxexecutionperbucket')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{2}.code_ctp,'propname','maxexecutionperbucket')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{3}.code_ctp,'propname','maxexecutionperbucket')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{4}.code_ctp,'propname','maxexecutionperbucket')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{5}.code_ctp,'propname','maxexecutionperbucket')),...
    num2str(strat.riskcontrols_.getconfigvalue('code',instruments{6}.code_ctp,'propname','maxexecutionperbucket')));

% strategy default setup basic information:
%                      code    cu1811    al1811    zn1811    pb1811    ni1811    rb1901
%                  stoptype       rel       rel       rel       rel       rel       rel
%                stopamount      -Inf      -Inf      -Inf      -Inf      -Inf      -Inf
%                 limittype       rel       rel       rel       rel       rel       rel
%               limitamount       Inf       Inf       Inf       Inf       Inf       Inf
%             bidopenspread         0         0         0         0         0         0
%            bidclosespread         0         0         0         0         0         0
%             askopenspread         0         0         0         0         0         0
%            askclosespread         0         0         0         0         0         0
%                 baseunits         1         1         1         1         1         1
%                  maxunits         1         1         1         1         1         1
%                 autotrade         0         0         0         0         0         0
%     maxexecutionperbucket         1         1         1         1         1         1
